//
//  matchEventViewCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/20.
//  strongright (c) 2015年 lanou3g. All rights reserved.
//

#import "matchEventViewCell.h"

#import "MatchScoreEventModel.h"

@interface matchEventViewCell ()

@property(nonatomic,strong)UILabel *teamName;

/**
 *第一节
 */
@property(nonatomic,strong)UILabel*firstScore;

/**
 *第二节
 */
@property(nonatomic,strong)UILabel*secondScore;


/**
 *第三节
 */
@property(nonatomic,strong)UILabel *thirdScore;






/**
 *第四节
 */
@property(nonatomic,strong)UILabel *fourthScore;








/**
 *总分
 */
@property(nonatomic,strong)UILabel*totalScore;




@end

@implementation matchEventViewCell



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        
        float partX = 0;
        float partY = 0;
        float partWidth = kScreenIp6(60);
        float partHeight = 35;
        
  
        
        
        //赛事
        self.teamName = [[UILabel alloc]initWithFrame:CGRectMake( partX, partY, partWidth + kScreenIp6(20), partHeight)];
        
        self.teamName.font = [UIFont systemFontOfSize:14];
        self.teamName.textAlignment = NSTextAlignmentCenter;
        self.teamName.text = @"";
        
        [self.contentView addSubview:_teamName];
        
        
        //第一节
        self.firstScore = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.teamName.frame),partY, partWidth , partHeight)];
        self.firstScore.font = [UIFont systemFontOfSize:14];
        self.firstScore.adjustsFontSizeToFitWidth = YES;
        self.firstScore.text = @"第一节";
        self.firstScore.textAlignment = 1;
        [self.contentView addSubview:_firstScore];
        
        
        
        
        
        //第二节
        self.secondScore = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.firstScore.frame) , partY, partWidth,partHeight)];
        self.secondScore.font = [UIFont systemFontOfSize:14];
        self.secondScore.adjustsFontSizeToFitWidth = YES;
        self.secondScore.text = @"第二节";
        self.secondScore.textAlignment = 1;
        [self.contentView addSubview:_secondScore];
        
        
        
        //第三节
        self.thirdScore = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.secondScore.frame) ,partY,partWidth, partHeight)];
        self.thirdScore.font = [UIFont systemFontOfSize:14];
        self.thirdScore.textAlignment = NSTextAlignmentCenter;
        self.thirdScore.adjustsFontSizeToFitWidth = YES;

        self.thirdScore.text = @"第三节";
        self.thirdScore.adjustsFontSizeToFitWidth = YES;
        
        [self.contentView addSubview:_thirdScore];
        
        
        
        //第四节
        self.fourthScore = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.thirdScore.frame),partY,partWidth,partHeight)];
        self.fourthScore.font = [UIFont systemFontOfSize:14];
        self.fourthScore.textAlignment = NSTextAlignmentCenter;
        self.fourthScore.adjustsFontSizeToFitWidth = YES;

        self.fourthScore.text = @"第四节";
        [self.contentView addSubview:_fourthScore];
        
        
        //总分
        self.totalScore = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.fourthScore.frame),partY,partWidth,partHeight)];
        self.totalScore.font = [UIFont systemFontOfSize:14];
        self.totalScore.textAlignment = NSTextAlignmentCenter;
        
        self.totalScore.text = @"总分";
        [self.contentView addSubview:_totalScore];
        
        //线
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, partHeight, kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];

        [self.contentView addSubview:footLineView];
        
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;

    }
    
    return self;
}

-(void)setCellValueWithModel:(MatchScoreEventModel*)model
{
    
    self.teamName.text = model.teamName;
    self.firstScore.text = model.firstScore;
    self.secondScore.text = model.secondScore;
    self.thirdScore.text = model.thirdScore;
    self.fourthScore.text = model.fourthScore;
    self.totalScore.text = model.totalScore;
    
}



- (void)customTextColor
{
    self.firstScore.textColor = [UIColor grayColor];
    self.secondScore.textColor = [UIColor grayColor];
    self.thirdScore.textColor = [UIColor grayColor];
    self.fourthScore.textColor = [UIColor grayColor];
    self.totalScore.textColor = [UIColor grayColor];
}




@end
